<?php
	require_once 'loginSuccess.php';
	
	if(isset($_POST['createAlbum'])) {
		$album = new Album($_POST['albumName'],$_POST['descr']);
		$dbConnection->addAlbumToDB($album);
		$albumId = $dbConnection->getLastAlbumId();
		
		$image = new Image();
		$image->uploadImgToFileSystem();
		$dbConnection->uploadImgToDB($image, $albumId);
	}
?>

<html>
	<body>
		<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
			<label for="albumName">Album Name: </label>
			<input type="text" name="albumName" id="albumName" /><br />
			<label for="descr">Description(optional)</label>
			<input type="text" name="descr" id="descr" /><br />
			<label>Choose Album Cover:</label>
			<input type="file" name="img" id="img" /><br />
			<input type="submit" value="Create" name="createAlbum" />
		</form>	
	</body>
</html>